<template>
  <cover-view :class="`nav-bar ${floating && 'floating'}`" @click="onBack">
    <ImgIcon v-if="showBack" cover class="icon" size="48*48" src="static/icons/back-arrows.png"></ImgIcon>
    <cover-view>{{ title == null ? "" : title }}</cover-view>
  </cover-view>
</template>

<script setup>
import ImgIcon from "@/components/ui/img-icon"
const { title, showBack, floating } = defineProps({
  title: String,
  showBack: Boolean,
  floating: Boolean
})
function onBack() {
  if (!showBack) return
  uni.navigateBack()
}
</script>

<style lang="less" scoped>
@import url("./index.less");
</style>
